package com.joe.demo.chat.server.service.impl;

import com.joe.demo.chat.server.service.IUserService;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description
 * @Author gaojw
 * @Date 2024-08-30
 */
public class UserServiceMemoryImpl implements IUserService {

    private Map<String, String> allUserMap = new ConcurrentHashMap<>();
    {
        allUserMap.put("zhangsan", "123");
        allUserMap.put("lisi", "123");
        allUserMap.put("wangwu", "123");
        allUserMap.put("zhaoliu", "123");
        allUserMap.put("qinqi", "123");
    }

    @Override
    public boolean login(String username, String password) {
        final String pass = allUserMap.get(username);
        if (pass == null){
            return false;
        }
        return pass.equals(password);
    }
}
